﻿#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <math.h>

typedef double Real;

 

typedef struct
{
	int n;
	int v[10];
}Context;
Context context = { 0 };

void add_number(int* ns, int v)
{
	if (v == 0) {
		ns[0]++;
		return;
	}
	while (v)
	{
		ns[v % 10]++;
		v /= 10;
	}
}

void read_data(Context* ctx)
{
	int v;
	scanf("%d", &ctx->n);
	for (int i = 0; i < ctx->n; ++i)
	{
		scanf("%d", &v);
		add_number(ctx->v, v);
	}
}  
void solve(Context* ctx)
{
	int k = 0;
	for (int i = 0; i < 10; ++i)
		if (k < ctx->v[i])
			k = ctx->v[i];
	printf("%d:", k);
	for (int i = 0; i < 10; ++i)
		if (k == ctx->v[i])
			printf(" %d", i);
	printf("\n");
}

int main()
{
	freopen("D:/Develop/GitRepos/MOOC/浙江大学/数据结构/201906/DataStructure/M2019秋C入门和进阶练习集/7-172.txt", "r", stdin);
	read_data(&context);
	solve(&context);
	return 0;
}
